/*
 * Copyright (c) $today.year-Now http://www.zxpnet.com All rights reserved.
 */

package com.zxp.security.repository;

import com.zxp.security.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/**
 * @author: shollin
 * @date: 2021/7/4/004 21:14
 */
public interface UserRepo extends JpaRepository<User,Long> , JpaSpecificationExecutor<User> {

    @Query(value = "FROM com.zxp.security.model.User t WHERE t.username=:username OR t.phone=:username ")
    User findByUsernameOrPhone(@Param("username") String username);

    User findByUsername(String username);
    User findByPhone(String phone);
}
